Optical encoders are widely used for measuring the position of machine elements. They are commercially available in a range of configurations for measuring either rotary or linear motion. This invention relates to the subset of encoders that produce incremental analog output signals in quadrature. These are typically referred to as “1 volt peak-peak” or simply “analog” encoders. An alternate encoder format, commonly called “A-quad-B”, produces a digital data stream rather than the analog voltage signals of analog encoders.
In reality, all high-resolution “digital” encoders are in fact analog encoders equipped with demodulators (or interpolators). The resulting demodulated encoder output is passed to an associated motion controller in a digital format.
Position information is encoded by an encoder as the phase of 2 analog signals in quadrature. A demodulator converts the phase of the analog signals to a position signal. In an incremental encoder, the analog signals repeat at a predetermined pitch. For instance, an incremental rotary encoder with 1024 lines per revolution will produce sinusoidal voltages that repeat every 2*π/1024 radians (or equivalently: 360/1024 degrees) of rotation of the encoder shaft. The demodulator must keep track of the number of full cycles as well as the phase within the current cycle in order to properly deduce the absolute position of the encoder.
The well known technique for demodulating incremental encoder signals involves measuring the phase of the signals (using the arc-tangent operation) to determine current position within an encoder period and detecting when the encoder has crossed from one period to a subsequent period. A “coarse” count is incremented (or decremented) with each period-crossing while the phase information is used to determine the current fraction of a period. The result might, for example, be represented as a fixed precision digital word within a computer or digital signal processor (DSP). With a 32-bit digital representation of position, the processor might use the lower 12 bits to represent the fraction of a period (derived directly from the phase of the encoder signals) while the upper 20-bits would be used to maintain the current count of complete periods. Such a representation would provide resolution of period/(212). For a hypothetical 1024 line rotary encoder, the resolution would be 2*π/(1024*4096) radians or approximately 1.5 micro radian resolution of shaft position.
It is well known that optical encoders exhibit cyclical errors (i.e. errors that substantially repeat from one period to the next). Cyclical errors are caused by offsets present in the analog encoder signals as well as relative gain and quadrature errors. Note that since the arctangent function is used to convert phase to position and since the arctangent function involves the ratio of sine and cosine voltages, only the relative gain error between the sine and cosine voltages is significant. The quadrature error causes the sine signal to be shifted slightly more or less than π/2 radians (90°) with respect to the cosine channel. The error sources produce cyclical errors in the conversion from phase to position. The result is an error signal superimposed upon the true position that can be described by the Fourier coefficients of the 1st and 2nd harmonic of the encoder period:Indicated_position=True_position+A1*cos(θ)+B1*sin(θ)+A2*cos(2*θ)+B2*sin(2*θ);where: θ is the nominal phase of the encoder signals (ie: θ=arctangent(sine/cosine)).
Consider a 1024 line rotary encoder rotating at 1000 rpm. The 1st and 2nd harmonics of the encoder will occur at 17067 and 34133 Hertz. If the encoder is used as the feedback device to control the motor speed, then the motion controller will sample the encoder output at a periodic rate (sample rate) determined by the controller. A typical sample rate might be 2000 Hertz (2 kHz).
A well known property of all sampled data systems is referred to as the Nyquist-Shannon sampling theorem (C. E. Shannon, “Communication in the presence of noise”). The theorem states that if a signal lies in the frequency interval between 0 and ½ the sampling frequency, then the signal can be completely reconstructed from its samples. One-half the sampling frequency is called the Nyquist frequency. A side effect of the sampling theorem is that frequencies outside the range {DC:Nyquist} will alias into the range when sampled. That is, a signal occurring at a much higher frequency than the Nyquist frequency will re-appear, after sampling, somewhere within the range of {DC:Nyquist}. This effect is called aliasing.
In the example above of a 1024 line encoder running at 1000 rpm, the 1st and 2nd harmonics lie well above the range {DC:1000} Hertz. As a result, the error terms will be aliased and will reappear within the range {DC:1000} Hertz. After aliasing, the encoder errors will appear at 933 and 133 Hertz. If the servo loop bandwidth is in the range of 100 Hertz (a reasonable value for a precision machine spindle, for example), then the servo loop will respond to the 133 Hertz error term, but respond negligibly to the 933 Hertz component. This will create vibration within the motor and structure to which it is attached. It will also produce unnecessary heat in the motor as it tries to compensate for what appears to be servo error, but in fact is false data produced by the encoder at a very high frequency, but aliased into a frequency range where the machine is sensitive. Continuing with this example, if the speed increased by 1% to 1010 rpm, the errors occurring at the 1st and 2nd harmonics of the encoder will originate at 17,237 and 34,475 Hertz but be aliased to 763 and 475 Hertz. For the same servo bandwidth, the motor may produce an audible hum at the 475 Hertz, but produce less shaking of the structure due to the diminished capability of the 100 Hertz servo loop bandwidth to compensate for a higher frequency error signal.
If the motor slows down 0.5% to 995 rpm, the error terms originate at 16,981 and 33,963 Hertz but alias to 981 and 37 Hertz. At 37 Hertz, the servo loop will have considerable gain with which to attempt to correct for the perceived error. The result may be significant noise, vibration and wasted power in the motor all of which are detrimental to precision motion applications.
The well known solution to avoid aliasing with sampled data systems is to filter the signal in the analog domain at below one-half the sampling rate. This ensures that the signal being sampled complies with the Nyquist-Shannon sampling theorem by attenuating frequencies above the Nyquist frequency.
Unfortunately, this is impractical in the case of encoders. For a 2000 Hertz servo sampling rate, the encoder signals would have to be filtered with analog low-pass filters at below 1000 Hertz. For a 1024 line encoder, the maximum speed would be limited to less than 60 rpm.
The problem stems from the fact that encoders are “wideband” sensors and therefore must not be filtered at low frequencies. Yet, the true signal of interest (the position of a machine slide or motor shaft, for instance) is a much lower bandwidth signal (hence the much lower sampling rate of the motion controller). What is needed is an improved way of extracting the low frequency position information about the machine that is encoded in the high-frequency encoder signals.
There are other sources of error affecting motion control systems that employ encoders. A common problem is the use of switching amplifiers to drive large motors. Switching amplifiers are the predominant amplifier for driving servo motors within industry. They are smaller and far more efficient than linear amplifiers. However, they are notorious for radiating electrical noise over a broad spectrum. Since the encoder is often located in close proximity to the motor (usually directly attached to the motor), the encoder may pick up some of the noise radiated from the amplifier as it drives the motor. Typical switching amplifiers radiate electrical noise in the range of 10,000 to 100,000 Hertz. Noise at such high frequencies would not normally affect a typical motion control system. However, if the noise is picked up by the encoder read head, it will affect the resulting position signal. The error signal will be aliased into the range from {DC:Nyquist} (or {DC:1000} Hertz in the example case). Certain frequencies may create significant problems for the servo system whereas other frequencies will have no effect at all.
The problem revealed in these examples is that the encoder signal is aliased by the sampling rate of the motion control system. Error frequencies that originate at (harmless) high frequencies are aliased by the motion controller sampling process and re-appear within the limited frequency band between DC and ½ the sampling frequency. Small changes in the source frequency (due to changing speed of the encoder, for instance) can turn a harmless error source into a significant error problem.
Offsets in the signal channels of the encoder cause errors that occur at the 1st harmonic of the encoder frequency (once per encoder period). Errors in the gain of one channel relative to the other cause a 2nd harmonic error (twice per encoder period). If the sine channel is not exactly orthogonal to the cosine channel, an error (quadrature error) will also be produced at the 2nd harmonic. Typical encoders may exhibit error amplitudes caused by offset, gain and quadrature imperfections of approximately 1% to 2% of the encoder period (“Encoders for Servo Drives” pg 25; “Signum SR, Si encoder system” pg 1; “Mercury II 4000 Series” pg 6). Prior art methods of reducing harmonic errors involve manipulating the grating period (U.S. Pat. Nos. 5,726,445 and 5,814,812) during grating manufacturer or by analyzing the variation in signal magnitude as a function of phase angle (U.S. Pat. Nos. 5,134,404 and 6,897,435). Another method disclosed in U.S. Pat. No. 6,956,505 is to compare the measured position with a running average estimated position when the machine axis is moving at constant speed in order to detect cyclical errors.
In some encoders, the corrections are determined during an initial setup operation or when the encoder makes an initial movement (Renishaw Signum; MicroE Mercury II; Numerik Jena RIK). The corrections are stored and applied as constant corrections for all subsequent motions. In some high precision applications, there is a need to reduce the 1st and 2nd harmonic errors even further. Also, many encoders exhibit a variation in the offset, gain and quadrature imperfections as a function of axis position. Correcting these imperfections requires adaptive compensation that can respond to encoder imperfections under normal operating conditions of the encoder. Another limitation of prior art encoder interpolators is a tradeoff between speed and resolution (Renishaw SR, pg 3; MicroE Mercury II, pg 5; Numerik Jena RIK, pg 7). Prior art method of demodulating quadrature signals requires sampling the encoder signals a minimum of four times per cycle. With four samples per cycle, it is possible to always determine the proper number of complete cycles. It is also possible to detect when an axis is moving faster than the maximum rated speed and thereby flag an error condition. The error condition can indicate to the motion controller that the encoder count is no longer reliable and that the machine axis should be shutdown.
The requirement to sample at least four times per encoder cycle leads to a tradeoff between speed, resolution and cost. A high resolution analog to digital converter (ADC) is needed to provide high resolution interpolation of analog encoder signals. However, a high-resolution ADC is more expensive and cannot sample at as high a sample rate as a low resolution ADC. Alternatively, a high-resolution, high-speed ADC can be selected, but will cost far more than a high-speed low resolution ADC.
Accordingly, it would be desirable to demodulate and interpolate encoder signals without aliasing high-frequency error sources while adaptively compensating for 1st and 2nd order encoder errors and to do so at high-resolution, high speed and moderate cost.